import ActionGroup from "./ActionGroup.vue"
import Enable from "./Enable.vue"
import moment from "moment";
/**
 * tooltip {boolean}  
 */
const columns = (showOperate) => {
  let arr = [
    // {
    //   type: 'selection',
    //   width: 55
    // },
    {
      label: 'User ID',
      prop: 'userId',
      width: 160,
      tooltip: true,
    },
    {
      label: 'Username(Loginname)',
      prop: 'username',
      width: 200,
      tooltip: true,
    },
    {
      label: 'Nickname',
      prop: 'nickname',
      width: 160,
      tooltip: false
    },
    {
      label: 'Role',
      prop: 'roleName',
      width: 160, 
      tooltip: false,
    },
    {
      label: 'Telephone',
      prop: 'phone',
      width: 180,
      tooltip: false,
    },
    {
      label: 'Creation Time',
      prop: 'creationtime',
      minWidth: 180,
      tooltip: false,
      formatter: (row, column, cellValue, index) => {
        return row.createTime ? moment(row.createTime).format('yyyy-MM-DD HH:mm:ss') : '';
      }
    },
    {
      label: 'Enable',
      prop: 'status',
      width: 140,
      tooltip: false,
      render: Enable
    }
  ]
  if(showOperate) {
    arr.push({
      label: "Operate",
      width: 300,
      render: ActionGroup
    })
  }
  return arr;
};
export default columns;